#******************************************************************
#
# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Import('env')
import os

stringtest_env = env.Clone()
src_dir = stringtest_env.get('SRC_DIR')

######################################################################
# Build flags
######################################################################
stringtest_env.PrependUnique(CPPPATH = [
        '../include',
        '#extlibs/gtest/gtest-1.7.0/include' ])

stringtest_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common')])
stringtest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
stringtest_env.PrependUnique(LIBS = ['c_common', 'gtest', 'gtest_main', 'pthread'])

if env.get('LOGGING'):
	stringtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
#
######################################################################
# Source files and Targets
######################################################################
stringtests = stringtest_env.Program('stringtests', ['linux/oic_string_tests.cpp'])

Alias("test", [stringtests])

env.AppendTarget('test')
if env.get('TEST') == '1':
	target_os = env.get('TARGET_OS')
	if target_os == 'linux':
                from tools.scons.RunTest import *
                run_test(stringtest_env,
                         'resource_ccommon_string_test.memcheck',
                         'resource/c_common/oic_string/test/stringtests')
